<template>
  <router-view></router-view>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useStore } from '@/store'

const useToLogin = () => {
  const route = useRoute()
  const router = useRouter()
  const store = useStore()
  if (!store.state.user?.token && route.name !== 'login') {
    router.push('/login')
  }
}

export default defineComponent({
  name: 'App',
  setup () {
    useToLogin()
    return {

    }
  }
})
</script>
